package screens;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import main.Fonts;
import main.UserInterface;

public class Demo extends JPanel implements MouseListener {
	
	private JButton lesson1;
	private JButton lesson2;
	private JButton lesson3;
	private JButton lesson4;
	private JLabel label;

	public Demo() {
		setPreferredSize(new Dimension(800, 600));
		setLayout(new FlowLayout());
		
		label = new JLabel("WHAT WOULD YOU LIKE TO FIND OUT ABOUT?", JLabel.CENTER);
		label.setFont(Fonts.default_font(32));
		label.setPreferredSize(new Dimension(800, 100));
		
		lesson1 = new JButton("Lesson 1: About the robot");
		lesson1.setPreferredSize(new Dimension(800, 100));
		lesson1.setFont(Fonts.default_font(32));
		lesson2 = new JButton("Lesson 2: Making the robot move");
		lesson2.setPreferredSize(new Dimension(800, 100));
		lesson2.setFont(Fonts.default_font(32));
		lesson3 = new JButton("Lesson 3: Editing/removing waypoints");
		lesson3.setPreferredSize(new Dimension(800, 100));
		lesson3.setFont(Fonts.default_font(32));
		lesson4 = new JButton("Lesson 4: Sensors");
		lesson4.setPreferredSize(new Dimension(800, 100));
		lesson4.setFont(Fonts.default_font(32));
		
		add(label);
		add(lesson1);		
		add(lesson2);
		add(lesson3);
		add(lesson4);
		
		lesson1.addMouseListener(this);
        lesson2.addMouseListener(this);
        lesson3.addMouseListener(this);
        lesson4.addMouseListener(this);
	}
	
	public JPanel getContentPane() {
		return this;
	}

	@Override
	public void mouseClicked(MouseEvent e) {
		if (e.getSource().equals(lesson1)) {
			UserInterface.setContentPane(UserInterface.lesson1);
		} else if (e.getSource().equals(lesson2)) {
			UserInterface.setContentPane(UserInterface.lesson2);
		} else if (e.getSource().equals(lesson3)) {
			UserInterface.setContentPane(UserInterface.lesson3);
		} else if (e.getSource().equals(lesson4)) {
			UserInterface.setContentPane(UserInterface.lesson4);
		}
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
}
